package games.ninJumpDx.ui.factorys
{
	import flash.display.SimpleButton;

	public class SimpleButtonFactory
	{
		protected var m_btn:SimpleButton;
		protected var m_name:String;
		
		public function SimpleButtonFactory()
		{
			// 抽象类
		}
		
		public function makeButton(name:String,x:Number = 0, y:Number = 0):SimpleButton
		{
			m_name = name;
			m_btn = createButton();
			m_btn.name = m_name;
			setLocation(x,y);
			return m_btn;
		}
		
		protected function createButton():SimpleButton
		{
			// 工厂方法 抽象方法子类需覆盖		
			return new SimpleButton();
		}
		
		protected function setLocation(x:Number,y:Number):void
		{
			m_btn.x = x;
			m_btn.y = y;
		}
	}
}